<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>支付表费用转出记录表 管理</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">支付表号</div>
                    <div class="field">
                        <input name="paySchNo" id="paySchNo" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">费用类型</div>
                    <div class="field">
                        <input name="feeTypCd" id="feeTypCd" data-value="" placeholder="请选择" ltype="combobox">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">处理方式</div>
                    <div class="field">
                        <input name="handleWayCd" id="handleWayCd" data-value="" placeholder="请选择" ltype="combobox">
                    </div>
                </div>

                <div class="formBtns notRight">
                    <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round">清空</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null,callback=null;
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/capital/capFeeOutLog/initList.do?qtype=1',
            method: 'get',
            columns: [
                {display: '支付表号', name: 'paySchNo', width: 160, align: 'left', enabledSort: false},
                {display: '费用类型', name: 'feeTypCdNm', width: 100, align: 'center', enabledSort: false},
                {display: '处理方式', name: 'handleWayCdNm', width: 100, align: 'center', enabledSort: false},
                {display: '转出金额', name: 'outAmt', width: 80, align: 'right', enabledSort: false,
                    render:function(rowdata,index,value){
                        return '&yen;'+FormatMoney(rowdata.outAmt/100);
                    }
                },
                {display: '转出时间', name: 'outDt', width: 90, align: 'center', enabledSort: false,render:renderDate},
                {display: '操作人', name: 'crtUsrNm', width: 100, align: 'left', enabledSort: false},
                {display: '备注', name: 'outRem', minWidth: 100, align: 'left', enabledSort: false,isEllipsis: false},
                {
                    display: '申请单号', name: 'flowId', minWidth: 80, align: 'center',
                    render: function (rowdata, rowindex, value, column) {
                        var pInstId = rowdata.pInstId == null ? " " : rowdata.pInstId;
                        var h = '';
                        if (pInstId == " ") {
                            h += "";
                        } else {
                            h += '<a href="javascript:commShowFlow(';
                            h += "'" + rowdata.pInstId + "',";
                            h += "'" + rowdata.audStsCd + "',";
                            h += "'" + rowdata.bizDataId + "'";
                            h += ')">' + rowdata.pNo + '</a>'
                        }
                        return h;
                    }, enabledSort: true
                }
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: true,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false
        });
        grid.setHeight(100);

        $("#handleWayCd").ligerComboBox({
            valueField: 'key',
            textField: 'value',
        });
        $("#feeTypCd").ligerComboBox({
            valueField: 'key',
            textField: 'value',
        });

        $("#searchBar").ligerForm();

        liger.get("handleWayCd").setData(${handleWayCdList});
        liger.get("feeTypCd").setData(${feeTypCdList});

        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            clearLigerForm("searchBar");
        });
        
        callback = function () {
            grid.reload();
        };
    });


    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }


    //显示流程：流程实例ID,状态,业务主键(租金表明细ID)
    function commShowFlow(_pInstId, _audStsCd, _businessKey){
        if(StringUtils.isEmpty(_pInstId)){
            UIUtils.alertWarning(CommonConstant.C_P_INSTANCEID_NOT_HERE);
            return;
        }
        var _formUrl = "/capital/cashDepositDeduction/toCashDepositDeductionPage.do";
        var params = "?pInsId="+_pInstId+"&status="+_audStsCd+"&businessKey="+_businessKey+"&formUrl="+_formUrl;
        Add_navTab('tab_cap_fee_out_log_flow_'+_businessKey,'查看流程',"<%=path%>/flow/flow/toFlowShowPageFowBus.do"+params);
    }
</script>

</body>
</html>
